package com.service;

import org.aspectj.lang.JoinPoint;

import java.util.Arrays;
import java.util.logging.Logger;

public class LogSpringAdvice {

    static Logger log = Logger.getLogger("LogSpringAdvice");
    //前置增强
    public void  before(JoinPoint jp){

        String info = String.format("开始%s--参数(%s)--执行...",
        jp.getSignature().getName(),
         Arrays.toString(jp.getArgs()));
        log.info(info);



    }
    //后置增强
    public void  after(JoinPoint jp,Object result){

        String info = String.format("结束%s--返回值(%s)--执行！",
                jp.getSignature().getName(),
                Arrays.toString(jp.getArgs()));
        log.info(info);

    }

}
